Function: c-before-change-check-<>-operators

c-before-change-check-<>-operators is a byte-compiled function defined in cc-engine.el.gz.

Signature

(c-before-change-check-<>-operators BEG END)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-before-change-check-<>-operators (beg end)
  ;; When we're deleting text, unmark certain pairs of "< .... >" which are
  ;; currently marked as template/generic delimiters.  (This marking is via
  ;; syntax-table text properties), and expand the (c-new-BEG c-new-END)
  ;; region to include all unmarked < and > operators within the certain
  ;; bounds (see below).
  ;;
  ;; These pairs are those which are in the current "statement" (i.e.,
  ;; the region between the {, }, or ; before BEG and the one after
  ;; END), and which enclose any part of the interval (BEG END).
  ;; Also unmark a < or > which is about to become part of a multi-character
  ;; operator, e.g. <=.
  ;;
  ;; Note that in C++ (?and Java), template/generic parens cannot
  ;; enclose a brace or semicolon, so we use these as bounds on the
  ;; region we must work on.
  ;;
  ;; This function is called from before-change-functions (via
  ;; c-get-state-before-change-functions).  Thus the buffer is widened,
  ;; and point is undefined, both at entry and exit.
  ;;
  ;; FIXME!!!  This routine ignores the possibility of macros entirely.
  ;; 2010-01-29.
  (when (> end beg)
  ;; Cope with removing (beg end) coalescing a < or > with, say, an = sign.
    (goto-char beg)
    (let ((ch (char-before)))
      (if (and (memq ch '(?< ?>))
	       (c-get-char-property (1- (point)) 'syntax-table)
	       (progn
		 (goto-char end)
		 (looking-at (if (eq ch ?<)
				 c-<-op-cont-regexp
			       c->-op-cont-regexp)))
	       (or (eq ch ?<)
		   (not (eq (char-after) ?>))))
	  (c-unmark-<>-around-region (1- beg) beg)))))